/**
 * 
 */
package cubelabs.nexus.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import cubelabs.nexus.entity.ChatMessage;

/**
 * @author deva
 *
 */
@Repository("chatMessageDAO")
public class ChatMessageDAO extends BaseDAO<ChatMessage, Long> {

	public List<ChatMessage> findByBid(Long bidId) {
		Criteria crit = getSession().createCriteria(getPersistentClass());
		if(bidId != null){
			crit.add(Restrictions.eq("bid.id", bidId));
		}
		return crit.list();
	}

}
